clear all
set more off
tempfile ubigeo temp


** DATA
use mergedp, clear
*keep if voted != .

local lista schoolin male rural native married head age year

label var schooling "Years of schooling"
label var male "Male"
label var rural "Rural"
label var native "Native"
label var married "Married"
label var head "Head of the household"
label var age "Age"
label var year "Year"

foreach var of varlist `lista' {
	global name_`var' : var label `var'

	sum `var' 
	glo m_`var' : di %12.3fc r(mean)
	glo sd_`var' : di %12.3fc r(sd)
	glo n_`var' : di %12.0fc r(N)
	glo min_`var' : di %12.0fc r(min)
	glo max_`var' : di %12.0fc r(max)
}

texdoc init Table_1.tex , replace
tex \begin{table}[h]
tex \caption{Summary statistics}
tex \label{tab:Table_1}
tex \begin{center}
tex \resizebox{11cm}{!}{
	tex \begin{tabular}{lccccccccccccccccccccccccccccccccccccccc} \hline \hline
    tex \\
	tex 					&	&  &   & Standard &   &      \\					
	tex 					&	& N & Mean & deviation & Min  & Max     \\					
	tex \\
	tex \hline
	tex \\
 	foreach var of varlist `lista'  {
     tex  \quad ${name_`var'}   & &  ${n_`var'} & ${m_`var'}  &  ${sd_`var'} &  ${min_`var'} & ${max_`var'}  \\
	}
	tex \\ \hline \hline
    tex \end{tabular}}
tex \end{center}
tex \end{table}
